{% extends "master.html" %}
{% block subtitle %} - 会员管理 - 新增会员{% endblock %}
{% block extJS %}
<script>
$(function() {
    
})
function to_save(){
    var flag = true;
    $('.required').each(function(){
        if(!$(this).val()){
            flag = false;
            $(this).parent().parent().removeClass('error')
            $(this).parent().parent().addClass('error')
        }
    })
    if(flag){
        $('#_form').submit()
    }else{
        alertError(['{{ MSG_FIELD_REQUIRED }}'])
        return false;
    }
}
</script>
{% endblock %}
{% block main %}
<div class="container">
    <div class="row">
        <ol class="breadcrumb">
            <li><a href="{{url_for('bpRoot.view')}}">主面板</a></li>
            <li><a href="{{url_for('.view')}}">会员管理</a></li>
            <li class="active">新增会员</li>
        </ol>
    </div>
    <form method='POST' action="{{url_for('.view', action='save')}}" id='_form'>
        <input type='hidden' name='fromAction' value='{{ fromAction }}'/>
        {% if obj.id %}
        <input type="hidden" name="mem-id" value='{{ obj.id }}'/>
        {% endif %}
        <input type="hidden" name="mem-shopID" value="{{ shop.id }}"/>
        <div class="row">
            <div class='btn-toolbar pull-right'>
                <button type="button" class="btn btn-success" onclick='to_save()'>保存</button>
                <a href="{{url_for('.view')}}" class="btn btn-inverse">取消</a>
            </div>
        </div>
    	<div class="row form-horizontal">
            <fieldset>
                <legend>会员详情</legend>
            	<div class='form3'>
                    <div class="control-group">
        				<label class="control-label">姓名</label>
        				<div class="controls">
                            <input type="text" name='mem-name' value='{{ obj.name if obj.name }}'/>
                            <a onclick="refreshMaster('supplierID','Supplier')" href="#">
                                <i class="glyphicon glyphicon-refresh"></i>
                            </a>

                            <a href="/spl/add" target="_blank">
                                <i class="glyphicon glyphicon-plus"></i>
                            </a>
        				</div>
                    </div>
                    <div class="control-group">
        				<label class="control-label">电话</label>
                        <div class="controls">
                            <input type="text" name='mem-mobile' value='{{ obj.mobile if obj.mobile }}'/>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">地址</label>
                        <div class="controls">
                            <input type="text" name='mem-address' value='{{ obj.address if obj.address }}'/>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label">身份证号</label>
                        <div class="controls">
                            <input type="text" name='mem-idCard' value='{{ obj.idCard if obj.idCard }}'/>
                        </div>
                    </div>
               	</div>
               	<div class='form3'>
                    <div class="control-group">
                        <label class="control-label">加入日期</label>
                        <div class="controls">
                            <input type="text" name="mem-joinTime" value="{{now()|ft}}" class="datepicker"/>
                        </div>
                    </div>
                    <div class="control-group">
        				<label class="control-label">店号</label>
        				<div class="controls">
        				  	<input type="text" value="{{ shop.no }}" disabled/>
        				</div>
                    </div>
                    <div class="control-group">
        				<label class="control-label">员工</label>
        				<div class="controls">
        				  	<input type="text" disabled/>
        				</div>
                    </div>
    	        </div>
                <div class='form3'>
                    <div class="control-group">
                        <label class="control-label">备注</label>
                        <div class="controls">
                            <textarea name='mem-remark'>{{obj.remark if obj.remark}}</textarea>
                        </div>
                    </div>
                </div>
            </fieldset>
	    </div>
	</form>
</div>
{% endblock %}